home *** CD-ROM | disk | FTP | other *** search
- ---ORG.DOC---
-
- The ORG Directive
-
- Syntax: ORG address
-
- ORG moves the output pointer for the segment currently being assembled to
- the value of the operand, which should be an absolute constant, or an
- expression evaluating to an absolute, non-forward-referenced constant.
-
- ORG is most often used in a DATA segment, to control the location of the
- data area within the segment. For example, in programs that fit entirely
- into 64K, you provide an ORG directive as the first line within your DATA
- segment at the top of your program. The location given by the ORG is some
- location that you are sure will be beyond the end of your program. If you
- are sure that your program will not go beyond 8K (02000 hex), your program
- can look like this:
-
- DATA SEGMENT
- ORG 02000 ; data goes here, beyond the end of the program
-
- (your data segment variable and buffer declarations go here)
-
- DATA ENDS
-
- (your program goes here)
-
-
- There is a special side-effect to ORG when it is used in the CODE segment.
- If you begin your code segment with ORG 0, then A86 knows that you are not
- assembling a .COM program; but are instead assembling a code segment to be
- used in some other context (programming a ROM, for example). The output
- file will start at 0, not 0100 as in a .COM file; and the default extension
- for the output file will be .OBJ, not .COM.
-
- Other than in the above example, you should not in general issue an ORG within
- the CODE segment that would lower the value of the output pointer. This is
- because you thereby put yourself in danger of losing part of your assembled
- program. If you re-assemble over space you have already assembled, you will
- clobber the previously-assembled code. Also, be aware that the size of the
- output program file is determined by the value of the code segment output
- pointer when the program stops. If you ORG to a lower value at the end of your
- program, the output program file will be truncated to the lower-value address.
-
- Again, almost no program producing a .COM file will need any ORG directive
- in the code segment. There is an implied ORG 0100 at the start of the program.
- You just start coding istructions, and the assembler will put them in the
- right place.
-
-
- The EVEN Directive
-
- Syntax: EVEN
-
- The EVEN directive coerces the current output pointer to an even value. It
- does so by adding 1 to the pointer is the pointer was odd; doing nothing if the
- pointer was already even. EVEN is most often used in data segments, before
- a sequence of DW directives. The 16-bit machines of the 86 family fetch words
- more quickly when they are aligned onto even addresses; so the EVEN directive
- insures that your program will have the faster access to those DW's that follow
- it. (This speed improvement will not be seen on the 8-bit machines, most
- notably the 8088 of the original IBM-PC.)
-